package com.cn.lp.export.server.base.result;


import com.cn.lp.export.server.base.utils.StringAide;

public class ResultCodeImpl implements ResultCode0, ResultCode1, ResultCode2, ResultCode3, ResultCode4 {

    private int code;
    private String message;
    private ResultCodeType resultCodeType;

    public ResultCodeImpl(int code, String message, ResultCodeType resultCodeType) {
        this.code = code;
        this.message = message;
        this.resultCodeType = resultCodeType;
        registerSelf();
    }

    @Override
    public int getCode() {
        return code;
    }

    @Override
    public String getRawMessage() {
        return message;
    }

    @Override
    public ResultCodeType getType() {
        return this.resultCodeType;
    }

    @Override
    public String getMessage(Object... params) {
        if (params.length > 0) {
            return StringAide.format(message, params);
        }
        return message;
    }

}
